//
//  SettingBaseViewController.m
//  01_kakin
//
//  Created by jon due on 12/03/21.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "SettingBaseViewController.h"

@implementation SettingBaseViewController

@synthesize settingTable = _settingTable;
@synthesize bgImgView = _bgImgView;
@synthesize settingAry = _settingAry;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    /*=== BGimg ===*/
    [ self.view addSubview:self.bgImgView ];
    
    /*=== table ===*/
    self.settingTable = [[ UITableView alloc ]initWithFrame:self.view.frame style:UITableViewStyleGrouped];
    self.settingTable.dataSource = self;
    self.settingTable.delegate = self;
    [ self.view addSubview:self.settingTable ];
    
}

-(void)dealloc{
    [ _settingTable release ];
    [ _bgImgView release ];
    [ _settingAry release ];
    [ super dealloc ];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

-(void)viewWillAppear:(BOOL)animated{
    [ super viewWillAppear:animated ];
    
    self.navigationController.navigationBarHidden = NO;
    self.title = @"設定";
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

/* ============================================================================== */
#pragma mark - UItable Datasource
/* ============================================================================== */

// セクション数
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return [ self sectionSize ];
}

// セクション内のセル数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [ self rowSize:section ];
}

// 列の高さ
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 45;
}

// セルの中身を返す
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return [ self createCell:indexPath ];
}


//- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
//{
//	
//    OnOffCell *cell = nil;
//    
//    static NSString *kAlertCell_ID = @"OnOffCell";
//    cell = [self.setTable dequeueReusableCellWithIdentifier:kAlertCell_ID];
//    if (cell == nil){
//        
//        cell = [[[ NSBundle mainBundle ] loadNibNamed:@"OnOffCell" 
//                                                owner:self
//                                              options:nil]lastObject];
//        
//    }
//    
//    return cell;
//        
//}

/* ============================================================================== */
#pragma mark - UItable delegate
/* ============================================================================== */

// セルの選択時のアクション
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [ self selectTableRow:indexPath ];
}

/* ============================================================================== */
#pragma mark - override method
/* ============================================================================== */

-(NSInteger)sectionSize{
    return 0;
}
-(NSInteger)rowSize:(NSInteger)section{
    return 0;
}
-(UITableViewCell*)createCell:(NSIndexPath*)path{
    return nil;
}
-(void)selectTableRow:(NSIndexPath*)path{
}


@end
